package cn.zhukelili.generic;

import java.util.Random;

/**
 * @Description: 结构对象
 * @Auther: hongheshou
 * @Date: 2018/7/23 15:23
 */
public class ObjectStruture {
    //对象生成器，这里通过一个工厂方法模式模拟
    public static Element createElement() {
        Random rand = new Random();
        if (rand.nextInt(100) > 50) {
            return new ConcreteElement1();
        } else {
            return new ConcreteElement2();
        }
    }
}
